package datatypes.kdTree;

import datatypes.Triangle;
import datatypes.Vertex;

public class TriangleContainsVertexCondition implements Condition {
	public Vertex v1, v2, v3;
	
	public TriangleContainsVertexCondition (Triangle triangle) {
		setTriangle(triangle);
	}
	
	public TriangleContainsVertexCondition (Vertex v1, Vertex v2, Vertex v3) {
		setTriangle(v1, v2, v3);
	}

	@Override
	public boolean satisfiedBy(Vertex vertex) {
		return vertex.isInside(v1, v2, v3, 0.00000001);
	}
	
	public void setTriangle(Triangle triangle) {
		this.v1 = triangle.getVertex1();
		this.v2 = triangle.getVertex2();
		this.v3 = triangle.getVertex3();
	}
	
	public void setTriangle(Vertex v1, Vertex v2, Vertex v3) {
		this.v1 = v1;
		this.v2 = v2;
		this.v3 = v3;
	}
	
	public void setVertex3(Vertex vertex) {
		this.v3 = vertex;
	}

}
